import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
	{
		path: "/index",
		component: () => import("../views/index.vue"),
		children: [
			{
				path: "/carsNav",
				name: "CarsNav",
				component: () => import("../components/cars/carsNav.vue"),
				children: [
					{
						path: "/carsList",
						name: "CarsList",
						component: () => import("../components/cars/carsList.vue"),
					},
				],
			},
			{
				path: "/carDetail",
				name: "CarDetail",
				component: () => import("../components/cars/carDetail.vue"),
			},
			{
				path: "/carSearch",
				name: "CarSearch",
				component: () => import("../components/cars/carSearch.vue"),
			},
			{
				path: "/usersList",
				name: "UsersList",
				component: () => import("../components/users/usersList.vue"),
			},
			{
				path: "/auditList/:ownerid",
				props:true,
				name: "AuditList",
				component: () => import("../components/users/auditList.vue"),
			},
			{
				path: "/orderlist",
				name: "OrderList",
				component: () => import("../components/order/orderList.vue"),
			},
			{
				path: "/addnewadmin",
				component: () => import("../components/admin/addnewadmin.vue"),
			},
			{
				path: "/adminlist",
				component: () => import("../components/admin/adminlist.vue"),
			},
		],
	},
	{
		path: "/login",
		component: () => import("../views/login.vue"),
	},
	{
		path: "/",
		component: () => import("../views/login.vue"),
	},
];

const router = new VueRouter({
	routes,
});

export default router;
